package com.dm;

import cn.hutool.cron.CronUtil;
import cn.hutool.cron.task.Task;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.ArrayList;

@Component
public class CommonRunner implements CommandLineRunner {

    @Override
    public void run(String... args) throws Exception {
        CronUtil.schedule("0 30 22 * * *", new Task() {
            @Override
            public void execute() {
                TestController.userList = new ArrayList<>();
            }
        });

        // 定时任务启动，支持秒级别定时任务
        CronUtil.setMatchSecond(true);
        CronUtil.start();
    }
}
